﻿<?php
if(!defined('IN_PHPSCUP'))exit('hacking'); 
class RoleModel extends BaseModel
{

    var $table  = 'role';	

    var $_page_rows = 20;	
	
    /* 插入数据 */
    function post($data)
    {    
  
		return $this->IU_Sql_Exe(array ('data' => array('role_name'=>"$data[name]",'config'=>"$data[config]"), 'mode' => 'INSERT'));

        
    }

    /* 修改数据 */
    function editpower($id ='',$data = '')
    {    
	       
		return $this->IU_Sql_Exe(array ('data' => array('powerdb'=>"$data"),'mode' => 'UPDATE','conditions' =>"role_id = '{$id}' "));
        
    }

    function show()
    {   
	
		 $info = $this->S_Sql_Exe(array('fields' =>'*'));
    
		 return $info;
        
    }

    function selectshow()
    {   
	
		 $info = $this->S_Sql_Exe(array('fields' =>'role_id,role_name'));
    
		 return $info;
        
    }	

    /* 删除数据 */
    function del($id ='')
    {      
		return $this->D_Sql_Exe(array ('conditions' =>"role_id = '{$id}' "));
        
    }

    /* 修改数据 */
    function editaction($id ='',$data = '')
    {    
	      
		return $this->IU_Sql_Exe(array ('data' => array('role_name'=>"$data[name]",'config'=>"$data[config]"),'mode' => 'UPDATE','conditions' =>"role_id = '{$id}' "));
        
    }


    /* 修改数据 */
    function editname($id ='',$data = '')
    {   
     
		return $this->IU_Sql_Exe(array ('data' => array('role_name'=>"$data[name]"),'mode' => 'UPDATE','conditions' =>"role_id = '{$id}' "));
        
    }


    /* 通过id取出一条数据 */
    function check($name ='')
    {    
	      
		 $info = $this->S_Sql_Exe(array('fields' =>'role_id','conditions' =>"role_name='{$name}'",'return' =>'one'));
    
		 return $info;
        
    }


    /* 通过id取出一条数据 */
    function oneshow($id ='')
    {    
	      
		 $info = $this->S_Sql_Exe(array('fields' =>'*','conditions' =>"role_id='{$id}'",'return' =>'one'));
    
		 return $info;
        
    }


}






?>